﻿Ext.define('I2R.view.configdepartments', {
    extend: 'Ext.Panel',
    alias: 'widget.i2rconfigdepartments',
    border: false,
    bodyCls: 'padd-up',
    layout: 'fit',
    initComponent: function () {
        var me = this;

        var departmentsstore = Ext.data.StoreManager.lookup('departments');

        me.items = [
            {
                id: 'departmentsgrid',
                xtype: 'grid',
                store: departmentsstore,
                columns: [
                    { header: '#', dataIndex: 'Id', width: 50 },
                    { header: 'Name', dataIndex: 'Name', width: 150 }
                ],
                dockedItems: [{
                    id: 'departmentsgrid-pager',
                    xtype: 'pagingtoolbar',
                    store: departmentsstore,   // same store GridPanel is using
                    dock: 'bottom',
                    displayInfo: true
                }],
                tbar: [
                    { xtype: 'button', text: 'Add department', action: 'adddepartment', iconCls: 'icon_building-add' }
                ]
            }
        ];


        me.callParent(arguments);
    }
});